package com.teemo.dp.builder.demo2;

import lombok.Data;

/**
 * @author Teemo
 */
@Data
public class Computer {
    private String cpu;
    private String hardDisk;
    private String memory;

    public Computer(ComputerBuilder computerBuilder) {
        this.cpu = computerBuilder.cpu;
        this.hardDisk = computerBuilder.hardDisk;
        this.memory = computerBuilder.memory;
    }


    public static class ComputerBuilder {
        private String cpu;
        private String hardDisk;
        private String memory;
        public ComputerBuilder() {
        }
        public ComputerBuilder cpu(String cpu) {
            this.cpu = cpu;
            return this;
        }
        public ComputerBuilder hardDisk(String hardDisk) {
            this.hardDisk = hardDisk;
            return this;
        }
        public ComputerBuilder memory(String memory) {
            this.memory = memory;
            return this;
        }
        public Computer build() {
            return new Computer(this);
        }
    }
}
